﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DFGK_WMS.Model.Models
{
    /// <summary>
    /// 盘点单
    /// </summary>
    [Table("T_StocktakingOrder")]
    public class StocktakingOrder:BaseEntity
    {
        /// <summary>
        /// 名称
        /// </summary>
        [MaxLength(60)]
        public string Name { get; set; }
        /// <summary>
        /// 订单号
        /// </summary>
        [MaxLength(60)]
        public string OrderSn { get; set; }
        /// <summary>
        /// 库房Id
        /// </summary>
        public long WarehouseId { get; set; }
        [MaxLength(60)]
        public string WarehouseCode { get; set; }
        /// <summary>
        /// 库房
        /// </summary>
        [MaxLength(60)]
        public string WarehouseName { get; set; }
        /// <summary>
        /// 库区Id
        /// </summary>
        public long? AreaId { get; set; }
        [MaxLength(60)]
        public string AreaCode { get; set; }
        /// <summary>
        /// 库区
        /// </summary>
        [MaxLength(60)]
        public string AreaName { get; set; }
      
        /// <summary>
        /// 单据类型Id
        /// </summary>
        public int? BillType { get; set; }
        /// <summary>
        /// ERP单据类型编码
        /// </summary>
        [MaxLength(60)]
        public string Erpcode { get; set; }
        /// <summary>
        /// 0：待打印1.待盘点 2，已盘点，3.已打印
        /// 单据状态：0-创建;1-提交;2-审核通过;3-作业中；4-已完成;5-强制完成;6-失效；7-异常
        /// </summary>
        public int Status { get; set; } = 0;
        /// <summary>
        /// 物料Id
        /// </summary>
        public long? MaterialId { get; set; }
        /// <summary>
        /// 物料名称
        /// </summary>
        [MaxLength(60)]
        public string MaterialName { get; set; }
        /// <summary>
        /// 批次号
        /// </summary>
        [MaxLength(60)]
        public string BatchNo { get; set; }
        /// <summary>
        /// 盘点计划：10-普通抽盘；20-临时抽盘；30-紧急抽盘；40-货主抽盘；50-库区抽盘；
        /// </summary>
        public int PlanType { get; set; } = 10;
        /// <summary>
        /// 盘点方法：0-全部盘点；10-不盘30天已盘点的库区；20-不盘15天已盘点的库区；30-不盘7天内已盘点的库区；
        /// </summary>
        public int StocktakeWay { get; set; } = 0;
        /// <summary>
        /// 单盘最大库位数
        /// </summary>
        public int? MaxLocationCount { get; set; }
        /// <summary>
        /// 盘点粒度：0-全部盘点；10-抽查盘点（5%库位）；20-抽查盘点（25%库位）；30-抽查盘点（50%库位）
        /// 
        /// </summary>
        public int? Granularity { get; set; } = 0;
        /// <summary>
        /// 库位数量
        /// </summary>
        public int CellCount { get; set; }
        /// <summary>
        /// 完成数量//盘点订单的数量
        /// </summary>
        public int FinishedCount { get; set; }
        /// <summary>
        /// 动碰次数
        /// </summary>
        public int? TouchTimes { get; set; }
        public DateTime? TouchStartDate { get; set; }
        public DateTime? TouchEndDate { get; set; }
        /// <summary>
        /// 循环次数
        /// </summary>
        public int LoopTimes { get; set; }
        /// <summary>
        /// 优先级
        /// </summary>
        public int PriorityLevel { get; set; }
        /// <summary>
        /// 盘点执行时间
        /// </summary>
        public DateTime? ExecDate { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(60)]
        public string Remark { get; set; }
      
        /// <summary>
        /// 提交时间
        /// </summary>
        public DateTime? SubmitDate { get; set; }
        /// <summary>
        /// 提交人Id
        /// </summary>
        public long? SubmitUserId { get; set; }
        /// <summary>
        /// 提交人
        /// </summary>
        [MaxLength(60)]
        public string SubmitUserName { get; set; }
        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? AuditDate { get; set; }
        /// <summary>
        /// 审核人Id
        /// </summary>
        public long? AuditUserId { get; set; }
        /// <summary>
        /// 审核人
        /// </summary>
        [MaxLength(60)]
        public string AuditUserName { get; set; }

        [NotMapped]
        public List<StocktakingOrderDetail> StocktakingOrderDetailList { get; set; }
= new List<StocktakingOrderDetail>();
    }
}
